<template>
    <div class="container">
		<h3>我的客户</h3>
        <el-form :model="ruleForm" ref="ruleForm" :rules="rules"  label-width="180px" class="demo-ruleForm">
           <el-table
               :data="tableData"
               border
               style="margin-top:20px;"
               ref="multipleTable"
               header-cell-class-name="table-header"
           >
			<el-table-column prop="name" sortable label="姓名"></el-table-column>
			<el-table-column prop="createTime" sortable label="申请时间"></el-table-column>
			<el-table-column prop="amount" sortable label="申请金额"></el-table-column>
			<el-table-column prop="loanPeriod" sortable label="还款周期"></el-table-column>
			<el-table-column prop="surplusAmount"  sortable label="剩余还款"></el-table-column>
			<el-table-column label="操作" width="150" align="center">
			    <template slot-scope="scope">
			        <el-button
			            type="text"
			            @click="handleCheckclient(scope.$index, scope.row)"
			        >查看</el-button>
			    </template>
			</el-table-column>
           </el-table>
           <el-pagination
               layout="total, prev, pager, next, jumper"
               :page-size="pagesize1"
               :current-page.sync="page"
               :total="total1"
               @current-change="handleCurrentChange1"
               style="margin-top: 20px"
           ></el-pagination>
            <el-form-item class="footerFixed" label-width="0px">
                <el-button @click="backPage">返回</el-button>
            </el-form-item>

        </el-form>
    </div>
</template>

<script>
import axios from "axios"
import uploadImg from '../../../common/uploadImg';
export default {
	components: {
	    uploadImg
	},
    data() {
        return {
			ruleForm:{},
			pagesize1:10,
			page:1,
			total1:0,

			tableData:[],
			amount:{},
			backname:{},
			bankShow:false,
			bankList:[],
			subBank:[],
            rules: {},
			id:''
        };
    },
    mounted() {

        this.init();

    },
    methods: {
		handleCurrentChange1(val){

			this.page = val;
			this.init();
		},

		// 返回上一页
        backPage() {
            this.$router.go(-1);
        },
		// 获取详情
        init(){
			let data1 = {
				page:this.page
			}
			axios.post("https://bbgy.cpzsyun.com:82/api/control/loanInfo/findByCustomer",data1).then((res)=>{
				this.tableData= res.data.rows
				this.total = res.data.total
				for(let i = 0 ; i<this.tableData.length;i++){
					this.tableData[i].createTime = this.tableData[i].createTime.substring(0,10)
				}
			})
		},

		handleCheckclient(index,row){
			this.$router.push({
			    path: '/finance/check2',
			    query: {
			        id: row.id
			    }
			});
		},
    }
};
</script>

<style scoped>
	.el-pagination {
	    text-align: center;
	}
</style>
